<template>
    <div id="app">
        
            <transition name="el-fade-in-linear">
                <router-view />
            </transition>
        
    </div>
</template>

<script>
import { mapState } from 'vuex';
import { info } from '@/plugins/auto.js';

export default {
    mounted() {
        // 检验cookie
        let _this = this;
        let token = this.$cookies.get('token');
        if (token) {
            _this.$get(_this.$api.user, {
                type: 'token',
                token: token
            })
            .then(function (res) {
                // 写入数据到Vuex
                _this.$store.commit('user/save_user', {
                    token: token
                });

                info(token);

            })
            .catch(function (error) {
                console.log(error);
            });
            console.log(token);
        }
    }
}
</script>